package com.jt.service;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.jt.pojo.Item;
import com.jt.vo.EasyUITableVO;
import com.jt.vo.ItemCat;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.jt.mapper.ItemMapper;

import java.util.List;

@Service
public class ItemServiceImpl implements ItemService {

	@Autowired
	private ItemMapper itemMapper;


	@Override
	public EasyUITableVO itemQuery(Integer page, Integer rows) {
		int startIndex = (page-1)*rows;
		List<Item> userList = itemMapper.itemQuery(startIndex,rows);
		// 获取总记录数
		Integer total = Integer.valueOf(itemMapper.selectCount(null));
		// 获取分页的结果
		return new EasyUITableVO(total,userList);
	}

	@Override
	public ItemCat queryItemName(Integer itemCatId) {

		return itemMapper.queryIteName(itemCatId);
	}
}
